<link rel="stylesheet" href="/Content/FileUpload/css/jquery.fileupload.css" />
<div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>
										<if condition="$info.id == 0">用户添加
    <else />用户修改
</if>
				
							</h5>
                            
                        </div>
                        <div class="ibox-content">
                            <form  action="/index.php/Home/Manage/add" id="myform" method="post" class="form-horizontal"  enctype="multipart/form-data">
                               <if condition="$info.id == 0">
							   <div class="form-group"><label class="col-sm-2 control-label">用户名</label>
                                    <div class="col-sm-10">
									<input type="text" name="username" class="form-control" value="{$info.username}">
									</div>
                                </div>
    <else />
	<input type="hidden" name="username" class="form-control" value="{$info.username}">
</if>
								
								
									<div class="form-group"><label class="col-sm-2 control-label">真实姓名</label>
                                    <div class="col-sm-10">
									<input type="text" name="truename" class="form-control" value="{$info.truename}" >
									</div>
                                </div>
									<div class="form-group"><label class="col-sm-2 control-label">密码</label>
                                    <div class="col-sm-10"><input type="text" name="password" class="form-control" value="{$info.password}"></div>
                                </div>
							
							
                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <button class="btn btn-primary" type="submit" >保存</button>
                                    </div>
                                </div>
								
								<input type="hidden" value="{$info.id}" name="id"  />
                            </form>
                        </div>
                    </div>
                </div>
  <script src="/Content/FileUpload/js/vendor/jquery.ui.widget.js"></script>
  <script src="/Content/FileUpload/js/jquery.iframe-transport.js"></script>
  <script src="/Content/FileUpload/js/jquery.fileupload.js"></script>
  <script>
 $(function () {
                'use strict';
                var url = "/upload.php";
                $('#fileupload').fileupload({
                    autoUpload: true,//是否自动上传
                    url: url,
                    dataType: 'json',
                    done: function (e, data) {
                       
                        console.log(data.result);
                        if (data.result.error == 1) {
                            swal("上传出错了!", data.result.message, "success");
                        } else {
                            var pic = data.result.pic;
                            $("#showpic").html("<img src='/" + pic + "' width='100px'/>");
                            $("#topimg").val(pic);


                        }
                    },
                    progressall: function (e, data) {
                        var progress = parseInt(data.loaded / data.total * 100, 10);
                        $('#progress .progress-bar').css(
                            'width',
                            progress + '%'
                        );
                    }
                }).prop('disabled', !$.support.fileInput)
                    .parent().addClass($.support.fileInput ? undefined : 'disabled');
					
	
 
        $(".selectList").each(function(){
            var areaJson;
            var temp_html;
            var oProvince = $(this).find(".province");
            var oCity = $(this).find(".city");
            var oDistrict = $(this).find(".district");
            //初始化省
            var province = function(){
			    temp_html = "<option value=''>请选择</option>"; 
                $.each(areaJson,function(i,province){
                    temp_html+="<option value='"+province.pid+"'>"+province.p+"</option>";
                });
                oProvince.html(temp_html);
                city();
            };
            //赋值市
            var city = function(){
                temp_html = "<option value='0'>请选择</option>"; 
                var n = oProvince.get(0).selectedIndex;
				
                $.each(areaJson[n-1].c,function(i,city){
                    temp_html+="<option value='"+city.ctid+"'>"+city.ct+"</option>";
                });
			
                oCity.html(temp_html);
                district();
            };
            //赋值县
            var district = function(){
                temp_html = "<option value='0'>请选择</option>"; 
                var m = oProvince.get(0).selectedIndex;
                var n = oCity.get(0).selectedIndex;
                if(typeof(areaJson[m-1].c[n-1].d) == "undefined"){
                    oDistrict.css("display","none");
                }else{
                    oDistrict.css("display","inline");
                    $.each(areaJson[m-1].c[n-1].d,function(i,district){
                        temp_html+="<option value='"+district.dtid+"'>"+district.dt+"</option>";
                    });
                    oDistrict.html(temp_html);
                };
            };
            //选择省改变市
            oProvince.change(function(){
                city();
            });
            //选择市改变县
            oCity.change(function(){
                district();
            });
            //获取json数据
            $.post("{:U('Home/Admin/getAreaJson')}",
     	           function (data) {
     		 	areaJson=data;
     		 	 province();
         }, 'json');
        });

	});
</script>